﻿using System;
using YasharEl.Infrastructure.Diagnostics.Logging;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Extensibility;

namespace YasharEl.Infrastructure.ApplicationModel.Bootstrap
{
    internal class BootstarpperLogger<TExtension> : ILogger<BaseBootstrapper<TExtension>>
        where TExtension : IBootstrappingExtension
    {
        public void Info(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(format, args);
        }

        public void Info(Exception exception, string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(
                string.Format("Exception occurred : {0}. Message : {1}",
                    exception,
                    string.Format(format, args))
            );
        }

        public void Warn(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(format, args);
        }

        public void Warn(Exception exception, string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(
                string.Format("Exception occurred : {0}. Message : {1}",
                    exception,
                    string.Format(format, args))
            );
        }

        public void Debug(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(format, args);
        }

        public void Debug(Exception exception, string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(
                string.Format("Exception occurred : {0}. Message : {1}",
                    exception,
                    string.Format(format, args))
            );
        }

        public void Error(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(format, args);
        }

        public void Error(Exception exception, string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(
                string.Format("Exception occurred : {0}. Message : {1}",
                    exception,
                    string.Format(format, args))
            );
        }

        public void Fatal(string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(format, args);
        }

        public void Fatal(Exception exception, string format, params object[] args)
        {
            System.Diagnostics.Debug.WriteLine(
                string.Format("Exception occurred : {0}. Message : {1}",
                    exception,
                    string.Format(format, args))
            );
        }

        public bool IsDebugEnabled
        {
            get { return true; }
        }

        public bool IsErrorEnabled
        {
            get { return true; }
        }

        public bool IsFatalEnabled
        {
            get { return true; }
        }

        public bool IsInfoEnabled
        {
            get { return true; }
        }

        public bool IsWarnEnabled
        {
            get { return true; }
        }
    }
}
